﻿using System;
using System.Collections.Generic;
using System.Text;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;

namespace GXJD.NewsPush.Models
{
    [Serializable]
    public class News
    {
        /// <summary>
        /// ID
        /// </summary>
        [BsonRepresentation(BsonType.ObjectId)]
        public string _id { get; set; }

        /// <summary>
        /// 操作元数据
        /// </summary>
        public Meta meta { get; set; }

        /// <summary>
        /// 网站
        /// </summary>
        public string webSite { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        public string title { get; set; }

        /// <summary>
        /// 发布日期
        /// </summary>
        [BsonDateTimeOptions(Kind = DateTimeKind.Local, Representation = BsonType.DateTime)]
        public DateTime? date { get; set; }

        /// <summary>
        /// 主页地址
        /// </summary>
        public string mainPage { get; set; }

        /// <summary>
        /// 链接地址
        /// </summary>
        public string url { get; set; }

        /// <summary>
        /// 完整链接地址
        /// </summary>
        public string url_f { get; set; }

        /// <summary>
        /// 页面内容
        /// </summary>
        public string content { get; set; }

        /// <summary>
        /// 是否推送标志
        /// </summary>
        public string isPushed { get; set; }

        /// <summary>
        /// 是否有效
        /// </summary>
        public string isVaild { get; set; }

        /// <summary>
        /// 是否有效
        /// </summary>
        public string isVaild2 { get; set; }

        /// <summary>
        /// 备用
        /// </summary>
        public int __v { get; set; }

    }

    /// <summary>
    /// 操作元数据
    /// </summary>
    [Serializable]
    public class Meta
    {
        /// <summary>
        /// 创建时间
        /// </summary>
        [BsonDateTimeOptions(Kind = DateTimeKind.Local, Representation = BsonType.DateTime)]
        public DateTime? createdAt { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        [BsonDateTimeOptions(Kind = DateTimeKind.Local, Representation = BsonType.DateTime)]
        public DateTime? updatedAt { get; set; }
    }
}
